<template>
    <div>
        <h3>用户名----{{id}}</h3>
        <div class="info">
            <span>发表时间：{{ time | dataFormate('YYYY-MM-DD') }}</span>
            <span>点击了：0次</span>
        </div>
        <hr>
        <div class="commentinner">
            <p>{{ contain }}</p>
        </div>
        <comment-box></comment-box>
    </div>
</template>

<script>
import comment from '../subcomponents/comment.vue'
export default {
    data(){
        return {
            // 获取URL中的id
            id: this.$route.params.id,
            time:'',
            contain:'',
        }
    },
    created(){
        this.find()
    },
    methods:{
        find(){
            var list = JSON.parse(localStorage.getItem('comment'))
            var target = list.some(item=>{
                if (item.id == this.id){
                    this.time = item.time
                    this.contain = item.detail
                    return true
                } 
            })
        }
    },
    filters:{
        moment(d){
           
        }
    },
    components:{
        'comment-box': comment
    }
}
</script>

<style scoped>
.info{
    display: flex;
    justify-content: space-between;
}
.commentinner{
    padding: 10px 4px;
}
</style>